<!DOCTYPE HTML>
<html>
    <head>
        <meta charset="UTF-8">
        <title>测试用例</title>
    </head>
    <body ms-controller="xxx">

        <script src="../avalon.js"></script>
        <script>
            avalon.ready(function() {
                var expect = function(a) {
                    return {
                        to: {
                            be: function(b) {
                                if (a === b) {
                                    console.log(true)
                                } else {
                                    console.log(a + " !== " + b)
                                }
                            }
                        }
                    }
                }
                var model = avalon.define('test', function(vm) {
                    vm.aaa = false
                })
                var body = document.body
                var div = document.createElement("div")
                div.innerHTML = ['<input ms-duplex-bool="aaa" type="radio" value="true">',
                    '<input ms-duplex-bool="aaa" type="radio" value="false">'
                ].join("")
                body.appendChild(div)
                avalon.scan(div, model)

                setTimeout(function() {
                    var inputs = div.getElementsByTagName("input")

                    expect(inputs[0].checked).to.be(false)
                    expect(inputs[1].checked).to.be(true)
                    inputs[0].click()
                    expect(inputs[0].checked).to.be(true)
                    expect(model.aaa).to.be(true)
                    //    body.removeChild(div)
                    //   done()
                }, 100)
            })
        </script>
    </body>
</html>